<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2017/9/23
 * Time: 10:52
 */

namespace app\common\model;


use traits\model\SoftDelete;

class Role extends BaseModel
{
    protected $table = 'ng_role';
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';
    protected $autoWriteTimestamp = 'datetime';

    use SoftDelete;
    protected $deleteTime = 'deleted_at';

    protected $hidden = [
        'created_at',
        'updated_at',
        'deleted_at'
    ];

    public function nodes()
    {
        return $this->hasMany('Access', 'role_id', 'id');
    }

    public function users()
    {
        return $this->hasMany('RoleUser', 'role_id', 'id');
    }

}